﻿using System;

using Microsoft.Xna.Framework;

using Ah.Testudin.Engine.Actors;

namespace Ah.Testudin.Engine.Graphics.Scenes.SceneNodes.Cameras
{
    public class FloatingCameraSceneNode : SceneNodeBase, ICameraSceneNode
    {
        #region Properties

        public Matrix Projection { get; private set; }

        public Matrix View { get; private set; }

        #endregion

        #region Constructors

        public FloatingCameraSceneNode(
            Matrix projection,
            Matrix transform)
            : base("Camera", null, RenderPass.StaticActor, transform)
        {
            this.Projection = projection;
        }

        #endregion

        #region SceneNodeBase

        public override void Render(Scene scene)
        {
            this.View = Matrix.CreateLookAt(
                this.Properties.ToWorldTransform.Translation,
                this.Properties.ToWorldTransform.Translation + this.Properties.ToWorldTransform.Forward,
                this.Properties.ToWorldTransform.Up);
        }

        #endregion
    }
}